package com.design.FactoryMode.mode3;

import java.util.HashMap;
import java.util.Map;

/**
 * 定义工厂类
 */
public class SmsCheckFactory {

    private static  final Map<Integer,ISmsCheckFactory> smsInstance = new HashMap<>(4);

    static {
        smsInstance.put(1,new RegisterServiceFactory());
        smsInstance.put(2,new ForgetPwdServiceFactory());
        smsInstance.put(3,new PayPwdServiceFactory());
        smsInstance.put(4,new WithdrawServiceFactory());
    }

    /**
     * 创建实例
     * @param type 类型 1：用户注册  2：找回密码  3：修改支付密码   4：提现
     */
    public static ISmsCheckFactory createSmsInstance(Integer type){
        return null == type ? null : smsInstance.get(type);
    }

}
